/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.isd.venta.modelo;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import com.isd.global.modelo.CodigoPostal;
import com.isd.global.modelo.Jurisdiccion;
import com.isd.global.modelo.Pais;

/**
 *
 * @author Claudio
 */
@Entity
@Table(name = "VTTENT",schema = "dbo")
public class DireccionesDeEntrega implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected DireccionesDeEntregaPK direccionesDeEntregaPK;
    @Basic(optional = false)
    @Column(name = "VTTENT_DESCRP", nullable = false, length = 60)
    private String descrp;
    @Column(name = "VTTENT_DIRECC", length = 60)
    private String direcc;
    @JoinColumn(name = "VTTENT_CODPAI", referencedColumnName = "GRTPAH_CODPAI", nullable = false, insertable=false, updatable=false)
    @ManyToOne(optional=false)
    private Pais pais;
    @ManyToOne(optional=false)
    @JoinColumns({
        @JoinColumn(name = "VTTENT_CODPOS", referencedColumnName = "GRTPAC_CODPOS", nullable = false),
        @JoinColumn(name = "VTTENT_CODPAI", referencedColumnName = "GRTPAC_CODPAI", nullable = false)
    })
    private CodigoPostal codigoPostal;
    
    @Column(name = "VTTENT_CNDIVA", length = 6)
    private String cndiva;
    @Column(name = "VTTENT_DIAENT")
    private Short diaent;
    @Column(name = "VTTENT_HORENT", length = 60)
    private String horent;
    @Column(name = "VTTENT_CONTAC", length = 60)
    private String contac;
    @Column(name = "VTTENT_TELEFN", length = 30)
    private String telefn;
    @Column(name = "VTTENT_CODCAM", length = 6)
    private String codcam;
    @Column(name = "VTTENT_CODTRA", length = 6)
    private String codtra;
    @JoinColumn(name = "VTTENT_JURISD", referencedColumnName = "GRTJUR_JURISD", nullable = false, insertable=false, updatable=false)
    @ManyToOne(optional=false)
    private Jurisdiccion jurisdiccion;
    @Column(name = "VTTENT_DEBAJA")
    private Character debaja;
    
    public DireccionesDeEntrega() {
    }

    public DireccionesDeEntrega(DireccionesDeEntregaPK direccionesDeEntregaPK) {
        this.direccionesDeEntregaPK = direccionesDeEntregaPK;
    }

    public DireccionesDeEntrega(DireccionesDeEntregaPK direccionesDeEntregaPK, String descrp) {
        this.direccionesDeEntregaPK = direccionesDeEntregaPK;
        this.descrp = descrp;
    }

    public DireccionesDeEntrega(String vttentNrocta, String vttentCdentr) {
        this.direccionesDeEntregaPK = new DireccionesDeEntregaPK(vttentNrocta, vttentCdentr);
    }

    public DireccionesDeEntregaPK getDireccionesDeEntregaPK() {
        return direccionesDeEntregaPK;
    }

    public void setDireccionesDeEntregaPK(DireccionesDeEntregaPK direccionesDeEntregaPK) {
        this.direccionesDeEntregaPK = direccionesDeEntregaPK;
    }

    public String getCndiva() {
        return cndiva;
    }

    public void setCndiva(String cndiva) {
        this.cndiva = cndiva;
    }

    public String getCodcam() {
        return codcam;
    }

    public void setCodcam(String codcam) {
        this.codcam = codcam;
    }

    public CodigoPostal getCodigoPostal() {
        return codigoPostal;
    }

    public void setCodigoPostal(CodigoPostal codigoPostal) {
        this.codigoPostal = codigoPostal;
    }

    public String getCodtra() {
        return codtra;
    }

    public void setCodtra(String codtra) {
        this.codtra = codtra;
    }

    public String getContac() {
        return contac;
    }

    public void setContac(String contac) {
        this.contac = contac;
    }

    public Character getDebaja() {
        return debaja;
    }

    public void setDebaja(Character debaja) {
        this.debaja = debaja;
    }

    public String getDescrp() {
        return descrp;
    }

    public void setDescrp(String descrp) {
        this.descrp = descrp;
    }

    public Short getDiaent() {
        return diaent;
    }

    public void setDiaent(Short diaent) {
        this.diaent = diaent;
    }

    public String getDirecc() {
        return direcc;
    }

    public void setDirecc(String direcc) {
        this.direcc = direcc;
    }

    public String getHorent() {
        return horent;
    }

    public void setHorent(String horent) {
        this.horent = horent;
    }

    public Jurisdiccion getJurisdiccion() {
        return jurisdiccion;
    }

    public void setJurisdiccion(Jurisdiccion jurisdiccion) {
        this.jurisdiccion = jurisdiccion;
    }

    public Pais getPais() {
        return pais;
    }

    public void setPais(Pais pais) {
        this.pais = pais;
    }

    public String getTelefn() {
        return telefn;
    }

    public void setTelefn(String telefn) {
        this.telefn = telefn;
    }
    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (direccionesDeEntregaPK != null ? direccionesDeEntregaPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DireccionesDeEntrega)) {
            return false;
        }
        DireccionesDeEntrega other = (DireccionesDeEntrega) object;
        if ((this.direccionesDeEntregaPK == null && other.direccionesDeEntregaPK != null) || (this.direccionesDeEntregaPK != null && !this.direccionesDeEntregaPK.equals(other.direccionesDeEntregaPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "tv.venta.modelo.DireccionesDeEntrega[direccionesDeEntregaPK=" + direccionesDeEntregaPK + "]";
    }

}
